﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;

namespace MetadataBasedConfig.POCO
{
    public class MdaDbContext : DbContext
    {
        #region Ctor

        public MdaDbContext()
            : base("name=Context")
        {
            //Database.CreateIfNotExists();
        }

        public MdaDbContext(string nameOrConnectionString)
            : base(nameOrConnectionString)
        {
            Database.CreateIfNotExists();
        }

        public MdaDbContext(DbCompiledModel model)
            : base(model)
        {
            Database.CreateIfNotExists();
        }

        #endregion

        #region Other Methods

        /// <summary>
        /// Mapping the Poco To DB
        /// </summary>
        /// <param name="modelBuilder"></param>
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }

        #endregion

        #region Sets

        public DbSet<Tenant> Tenants
        {
            get
            {
                return base.Set<Tenant>();
            }
        }

        public DbSet<User> Users
        {
            get
            {
                return base.Set<User>();
            }
        }

        #endregion

    }
}